package bookstore.domain;

import java.io.Serializable;

@SuppressWarnings("serial")
public class Order implements Serializable{		
	private int code;      
	private int status;    
	private Book book;  // ordered book
	
	static int count;	// for code generation
	
	static {		
		count = 100; // minimum code number
	}	
	
	public Order(Book book){
		code = count++;
		this.status = CODE.ORDER_STATUS_INIT;
		this.book = book;	
	}
	
	public int getCode() { return code; }
	public int getStatus() { return status; }
	public Book getBook() { return book; }
	
	public void setStatus(int status){
		this.status = status;
	}
	
	public String toString(){
		return String.format("[%s] %s| %d| $%d| %s",code,MSG.ORDER_STAUS[status]
				,book.getCode(),book.getPrice(),book.getTitle());
	}
}
